﻿using System;
using System.Data;
using System.Web.UI;
using AjaxPro;
using WorkFlow.DBProxy;

namespace WorkFlow.Desinger.newDesinger
{
    [AjaxNamespace("ns")]
    public partial class Authors : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(GetType(), Page);
        }

        [AjaxMethod]
        public DataTable GetOrgs(string name)
        {
            return DB.MapToDataTable(string.IsNullOrEmpty(name) ? @"select  f_id as TID,f_name as TNAME from t_organizations" : string.Format(@"select  f_id as TID,f_name as TNAME from t_organizations where f_name like '%{0}%' ",name));
        }

        [AjaxMethod]
        public DataTable GetRoles(string name)
        {
            return DB.MapToDataTable(string.IsNullOrEmpty(name) ? @"select f_id as TID,f_name as TNAME from t_roles" : string.Format(@"select f_id as TID,f_name as TNAME from t_roles where f_name like '%{0}%' ",name));
        }

        [AjaxMethod]
        public DataTable GetUsers(string name)
        {
            return DB.MapToDataTable(string.IsNullOrEmpty(name) ? @"select F_ID AS TID,F_NAME AS TNAME from t_users" : string.Format(@"select F_ID AS TID,F_NAME AS TNAME from t_users where F_NAME like '%{0}%' ",name));
        }
    }
}